bitkeeper revision 1.1300 (425ef0b4lXDHXsulXDmrVOvOZAhPXQ)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 14 Apr 2005 22:37:40 +0000 (22:37 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 14 Apr 2005 22:37:40 +0000 (22:37 +0000)
Do not STI when transitioning from user to kernel mode in
x86/64 Xen. Otherwise, by directly entering restore_all_guest
without first executing test_all_events, we risk ignoring
pending softirq and event-delivery work.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/x86_64/entry.S

index 2002acd9cebbf146a47eff3643f7295019e8c121..5cee142c18a53909cf07a6c66eaf5a0d852fd746 100644 (file)
         movq (reg),reg;
 
         ALIGN
+/* %rbx: struct exec_domain, interrupts disabled */
+switch_to_kernel:
+        leaq  EDOMAIN_trap_bounce(%rbx),%rdx
+        movq  EDOMAIN_syscall_addr(%rbx),%rax
+        movq  %rax,TRAPBOUNCE_eip(%rdx)
+        movw  $0,TRAPBOUNCE_flags(%rdx)
+        call  create_bounce_frame
+
 /* %rbx: struct exec_domain */
 restore_all_guest:
         RESTORE_ALL
@@ -104,20 +112,12 @@ ENTRY(syscall_enter)
         pushq $0
         movl  $TRAP_syscall,4(%rsp)
         SAVE_ALL
-        sti
         GET_CURRENT(%rbx)
         testb $TF_kernel_mode,EDOMAIN_thread_flags(%rbx)
-        jnz   hypercall
+        jz    switch_to_kernel
 
-        leaq  EDOMAIN_trap_bounce(%rbx),%rdx
-        movq  EDOMAIN_syscall_addr(%rbx),%rax
-        movq  %rax,TRAPBOUNCE_eip(%rdx)
-        movw  $0,TRAPBOUNCE_flags(%rdx)
-        call  create_bounce_frame
-        jmp   restore_all_guest
-
-/* %rbx: struct exec_domain */
-hypercall:
+/*hypercall:*/
+        sti
         movq  %r10,%rcx
         andq  $(NR_hypercalls-1),%rax
         leaq  SYMBOL_NAME(hypercall_table)(%rip),%r10